package com.zhsecurity.userdetails;

import com.zhsecurity.Admin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserDetailsService;

import java.util.Arrays;
import java.util.List;

@Configuration
public class UserDetailsServiceConfig {
    @Bean
    public UserDetailsService memoryUserDetailsService() {
        MemoryUserDetailsServiceImpl memoryUserDetailsService = new MemoryUserDetailsServiceImpl();
        List<Admin> admins = Arrays.asList(new Admin[]{
                new Admin("root", "root", "1"),
                new Admin("zhanghao", "zhanghao", "1")
        });
        memoryUserDetailsService.setAdmins(admins);
        return memoryUserDetailsService;
    }
}
